<?php

class Retailer_Backend_Block_Adminhtml_Wholesale_Edit_Tab_Payment extends Mage_Adminhtml_Block_Widget_Form
{
  protected function _prepareForm()
  {
      $form = new Varien_Data_Form();
      $this->setForm($form);
      $form->setDataObject(Mage::registry('backend_data'));
      //$session = Mage::getSingleton('adminhtml/session');
      $user = Mage::getSingleton('admin/session')->getUser();
      $model = Mage::getModel('backend/backend')->load($user->getUserId());
      $dataModel = Mage::registry('backend_data');
      $payInfo = $dataModel->getBillingAddress();
      //$shippingAddress = $dataModel->getShippingAddress();
      $fieldset = $form->addFieldset('payment_form', array('legend'=>Mage::helper('backend')->__('Payment information')));

      $fieldset->addField('subtotal', 'label', array(
          'label'     => Mage::helper('backend')->__('Total Purchased:'), //Mage::getModel('admin/user')->load($session->getId())->getId()
          //'class'     => 'required-entry',
          //'required'  => false,
          'name'      => 'subtotal',
          'type'  => 'currency',
          'value'     => "\${$dataModel->getSubtotal()}",
      ));
      (float)$value=(float)($dataModel->getSubtotal() * $model->getCommission());
      (float)$comm=(float)($model->getCommission() * 100);
      $fieldset->addField('commission', 'label', array(
          'label'     => Mage::helper('backend')->__("Commission (%$comm):"), //Mage::getModel('admin/user')->load($session->getId())->getId()
          //'class'     => 'required-entry',
          //'required'  => false,
          'name'      => 'commission',
          'type'  => 'currency',
          'value'     => "\${$value}",
      ));
      
//      $fieldset->addField('username', 'label', array(
//          'label'     => Mage::helper('backend')->__('Username(security reasons)'),
//          'required'  => true,
//          'name'      => 'username',
//      ));
//
//     $fieldset->addField('password', 'label', array(
//          'label'     => Mage::helper('backend')->__('Password(security reasons)'),
//          'required'  => true,
//          'name'      => 'password',
//      ));
//
//      $fieldset->addField('status', 'select', array(
//          'label'     => Mage::helper('backend')->__('Status'),
//          'name'      => 'status',
//          'values'    => array(
//              array(
//                  'value'     => 1,
//                  'label'     => Mage::helper('backend')->__('Enabled'),
//              ),
//
//              array(
//                  'value'     => 2,
//                  'label'     => Mage::helper('backend')->__('Disabled'),
//              ),
//          ),
//      ));
//
//      $fieldset->addField('content', 'editor', array(
//          'name'      => 'content',
//          'label'     => Mage::helper('backend')->__('Content'),
//          'title'     => Mage::helper('backend')->__('Content'),
//          'style'     => 'width:700px; height:500px;',
//          'wysiwyg'   => false,
//          'required'  => false,
//      ));
                
     
      if ( Mage::getSingleton('adminhtml/session')->getBackendData() )
      {
          //$form->setValues(Mage::getSingleton('adminhtml/session')->getBackendData());
          //Mage::getSingleton('adminhtml/session')->setBackendData(null);
      } elseif ( Mage::registry('backend_data') ) {
          //$form->setValues(Mage::registry('backend_data')->getData());
      }
      return parent::_prepareForm(); 
  }
}